package com.swyc.osschat.Test.designMode.visitor.vo;

import com.swyc.osschat.Test.designMode.visitor.service.Friend;
import com.swyc.osschat.Test.designMode.visitor.service.Room;

import java.util.ArrayList;
import java.util.List;

/**
 * @description 对象结构角色：房子
 * @Author: z156940l@outlook.com
 * @className Home
 * @Date: 2022/6/27 16:12
 */
public class Home {

    //房子中包含房间
    private List<Room> list = new ArrayList<>();

    public void addRoom(Room room){
        list.add(room);
    }

    public void action(Friend friend){
        for (Room room:list){
            room.accept(friend);
        }
    }
}
